#!/bin/sh

export LD_LIBRARY_PATH=/l/tijmp/lib/:$LD_LIBRARY_PATH
export JAVA_HOME=/l/jdk1.6/

if [ -z $MNG_MAX_HEAP ]; then
	MNG_MAX_HEAP=256m
fi

export HASTHI_HOME=$2
cd $HASTHI_HOME
for i in $HASTHI_HOME/lib/*.jar
do
  CLASSPATH=$CLASSPATH:$i
done

CLASSPATH=$HASTHI_HOME/classes:$CLASSPATH
HASTHI_ADDON_HOME=$HASTHI_HOME/../../../management-addon/build/
if [ -e $HASTHI_ADDON_HOME ];then
	CLASSPATH=$CLASSPATH:$HASTHI_ADDON_HOME/lib/hyperic-sigar-1.5.0.1/sigar-bin/lib/sigar.jar
fi	

if [ ${#} -eq 3 ];then 
	$JAVA_HOME/bin/java -agentlib:tijmp -Xmx$MNG_MAX_HEAP -classpath  $CLASSPATH  -Dhasthi.logDir=$3 hasthi.tools.analyze.TestManager $1 $2
else
	$JAVA_HOME/bin/java -agentlib:tijmp -Xmx$MNG_MAX_HEAP -classpath  $CLASSPATH  hasthi.tools.analyze.TestManager $1 $2
fi
